from InputHandler import InputHandler
from panda3d.core import *

class KeyboardMouseHandler(InputHandler):
    def __init__(self):
        InputHandler.__init__(self)    
        self.accept("arrow_left", self.beginTurnLeft)
        self.accept("arrow_left-up", self.endTurnLeft)
        self.accept("arrow_right", self.beginTurnRight)
        self.accept("arrow_right-up", self.endTurnRight)
        self.accept("arrow_up-up", self.endTurnUp)
        self.accept("arrow_up", self.beginTurnUp)
        self.accept("arrow_down", self.beginTurnDown)
        self.accept("arrow_down-up", self.endTurnDown)        
        self.accept("space", self.beginShot)
        self.accept("space-up", self.endShot)

        taskMgr.add(self.updateInput, "update input")


    def updateInput(self, task):
        self.dispatchMessages()
        return task.cont
